/**
 * Created by huanlai.whl on 2017/3/16.
 */
function QrcodeImage(imgId, packageName){
    this.imgId = imgId;
    this.base = blitz.load('base');
    this.path = '/data/app/' + packageName + "/" + this.imgId + ".jpeg";
}

QrcodeImage.prototype.update = function(content){
    if(content){
        this.content = content;
    }
    this.base.commonApi({
        obj: "BLTyid",
        method: "makeQRCodeImage",
        params: {
            code: this.content,
            outpath: this.path,
        }
    }, function(e) {
        console.log("getQrcode id == " + this.imgId + JSON.stringify(e));
        var domImpl = document.getElementById(this.imgId);
        if(domImpl){
            domImpl.src = this.path + "?t=" + new Date().getTime();
        }
    }.bind(this), function(e) {
        console.log("fail: " + JSON.stringify(e));
    });
}
